var member;
//存放所有的地址信息
var regionList;
var cityList;
var countyList;
$(function(){	;
	if(member){
		$("#mId").val(member.mId);
	}else{
		window.location.href=rootPath + '/member/loginPre?redirect=/';
	}
	/*var ad = ${mAddress}
	alert(ad);*/
	//获取默认收货地址
	defaultAddress();

	/**订单结算-----选择地址-跳转地址列表页面**/
	$('.orderAddress').click(function(){
		var ma_id = $("#ma_id").val();
		location.href=rootPath + '/address/maAdress?ma_id='+ma_id;
	});
});

//获取默认收货地址
function defaultAddress(){
	//获取会员地址唯一id、判断是否为空
	var ma_id = $("#ma_id").val();
	var url = rootPath + "/address/selectDefaultAddress";
	var result =  CommnUtil.ajax(url,{"mId":member.mId,"ma_id":ma_id},"json");
	if (result.resultSuccess) {
		address = result.data;
		if(address){
			$("#addressId").val(address.maId);
			$(".orderAddress .addressInfo > .fl").text("收货人：" + address.name);
			$(".orderAddress .addressInfo > .fr").text(address.tel);
			$(".orderAddress .oad").text("收货地址：" + address.street);
		} 
	}else {
		alert(result.resultDesc);	
	}
}